<?php
/**
 * YICMS
 * ============================================================================
 * 版权所有 2014-2017 YICMS，并保留所有权利。
 * 网站地址: http://www.yicms.vip
 * ----------------------------------------------------------------------------
 * 这不是一个自由软件！
 * 不允许对程序代码以任何形式任何目的的再发布。
 * ============================================================================
 * Created by PhpStorm.
 * Author: kenuo
 * Date: 2017/11/17
 * Time: 下午4:38
 */

namespace App\Services\Config;

use App\Handlers\role;
use App\Models\Config\Games;
use Auth;
use Route;
use Zhuzhichao\IpLocationZh\Ip;
use App\Repositories\Config\ServersRepository;
use Cache;

class ServersService
{

    protected $channelsRepository;

    public function __construct(ServersRepository $serversRepository)
    {
        $this->serversRepository = $serversRepository;
    }

    /**
     * 获取分页后所有数据
     */
    public function getPage($request)
    {
        $server = $this->serversRepository->getPage($request);

        return $server;
    }

    /**
     * 获取所有数据
     */
    public function getAll()
    {
        $server = $this->serversRepository->getAll();

        return $server;
    }


    public function ById($id)
    {
        return $this->serversRepository->getById($id);
    }

    public function update($request, $id)
    {
        $datas = $request->all();

        $server = $this->serversRepository->getById($id);

        $server->update($datas);

        return $server;
    }
}